<?php
require_once '../inc/config.php';/* 得到session_start */
require_once '../inc/user.php';
require_once '../inc/book.php';
require_once 'header.php';

?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
		<title>金币兑换-阅读记</title>
		<link rel="stylesheet" href="../css/exchange.css">
		<script type="text/javascript" src="../inc/jquery-2.1.1.min.js"></script>
		<script src="../script/index.js"></script>
	</head>
	<body>
	    <div class="box1">
	       <?php 
	           $current_user=$_SESSION["CURRENT_USER"];
	           $uId=$current_user["uId"];
	           $mon=getMoney($uId);
	           $money=$mon["money"];
	           $la.=<<<la
                  <p style="font-size:48px;font-family:方正粗黑宋简体;color:#494949">你拥有的金币数：$money</p>   
                  <p style="font-size:48px;font-family:方正粗黑宋简体;color:#494949">下面的书籍如果有喜欢的，可以用相应的金币兑换哟亲~</p>              
la;
           echo $la;
	       ?>
	    </div>
	
           <div class="box2">
           <?php  
		          $book=getbook();
		          $li=""; 
                  for ($i=0; $i<4; $i++) {//循环输出    
                  $bookName=$book[$i]["bookName"];
                  $bookPic=$book[$i]["bookPic"];
                  $bookId=$book[$i]["bookId"];
                  $li.=<<<li
                  <div class="xiaobox2">
                  <p style="font-size:36px;">$bookName</p>
                  <img src="../image/book/$bookPic"  width="190px" height="230px";/>
                  <p style="font-size:28px;">所需金币：10</p>
                  <div class="box3">
						<a href="../admin/doChange.php?bookId=$bookId&bookName=$bookName" onclick="return confirm('请问亲亲确认要兑换这本书吗？');">兑换</a>
					</div>
                  </div>
li;
          } echo $li;      //输出书本列表信息  ?>
               
	</div><!-- /box2 -->
	

<?php require_once 'footer.php';?>
</body>
</html>